﻿using MediatR;
using T.Personnel.Domain;
using T.Personnel.Read.API.Application.Command.RegisterCommand;
using T.Personnel.Repository.Interface;

namespace T.Personnel.Read.API.Application.CommandHandler.RegisterHandler
{
    public class GetRegisterHandler : IRequestHandler<GetRegisterCommand, Register>
    {
        private readonly IRegisterRepository registerRepository;

        public GetRegisterHandler(IRegisterRepository registerRepository)
        {
            this.registerRepository = registerRepository;
        }

        public async Task<Register> Handle(GetRegisterCommand request, CancellationToken cancellationToken)
        {
            return await registerRepository.GetRegisterAsync(request.id);
        }
    }
}
